
team.SetUp( 1, "Citizens", Color( 0, 120, 0, 255 ) );
team.SetUp( 2, "Civil Protection", Color( 102, 127, 255, 255 ) );
team.SetUp( 3, "OverWatch", Color( 68, 98, 174, 255 ) );
team.SetUp( 4, "OverWatch Elite", Color( 255, 217, 48, 255 ) );
team.SetUp( 5, "City Administrators", Color( 255, 0, 0, 255 ) );
team.SetUp( 6, "Miscellanous", Color( 100, 100, 100, 255 ) );

TS = { }

TS.ItemsData = { }

TS.MapViews = { }
TS.MapViews["gm_construct"] = { 

	ang = Angle( 20.314821243286, 47.419368743896, 0 ),
	pos = Vector( -1063.2745361328, -1709.8194580078, 610.81103515625 ),

}

TS.MapViews["rp_c18_v1"] = {
 
	--pos = Vector( -933.031250, -997.093750, 671.875000 ),							
	--ang = Angle( -14.300041, 38.359814, 0.000000 ), 
	
	--1142.437500 -3659.375000 701.406250;setang -51.140129 146.180527 0.000000
	--setpos -1044.406250 345.031250 717.250000;setang -18.259979 90.699890 0.000000

	pos = Vector( -1044.406250, 345.031250, 717.250000 ),
	ang = Angle( -18.259979, 90.699890, 0.000000 ),
	
}	

TS.MapViews["rp_canals_final_fix"] = {

	--setpos 3441.687500 -720.718750 189.906250;setang 13.199959 65.140076 0.000000

	pos = Vector( 3441.687500, -720.718750, 189.906250 ),
	ang = Angle( 13.199959, 65.140076, 0.000000 ),
	
}	
		
TS.MapViews["rp_tb_city45_v02n"] = {
	
	pos = Vector( 259.531250, 3688.125000, 777.312500 ),
	ang = Angle( 21.999979, -120.679893, 0 ), 
}							 
TS.MapViews["rp_central17_v3_dsrp"] = { 

	pos = Vector( -3818.437500, -1343.500000, 624.500000 ),
	ang = Angle( 44.509331, 89.896324, 0.000000 ), 

}
TS.MapViews["rp_city11_night"] = {

	pos = Vector( -3098.781250, -2103.437500, -828.031250 ),
	ang = Angle( 27.720007, 125.220322, 0.000000 ),
	
	}
	
TS.MapViews["rp_city11_night_v1b"] = {

	--setpos -3556.375000 -461.343750 -864.093750;setang 21.999996 -72.339935 0.000000
	
	pos = Vector( -3556.375000, -461.343750, -864.093750 ),
	ang = Angle( 21.999996, -72.339935, 0.000000 ),
	
}	

TS.MapViews["rp_city8_district9"] = {

	--setpos 8861.031250 -209.218750 -220.843750;setang 1.979892 50.679825 0.000000

	pos = Vector( 8861.031250, -209.218750, -220.843750 ),
	ang = Angle( 1.979892, 50.679825, 0.000000 ),
	
}	

					
TS.MapNames = { }

TS.MapNames["rp_c18_v1"] = "City 18";
TS.MapNames["rp_central17_v3_dsrp"] = "Central 17";
TS.MapNames["rp_city11_night"] = "City 11";
TS.MapNames["rp_canals_final_fix"] = "City 11 Canals";
TS.MapNames["rp_city11_night_v1b"] = "City 11";
TS.MapNames["rp_city8_district9"] = "City 8, District 9";


TS.MaxInventories = 5;

TS.HUDItemInfo = { }

TS.SelectablePlayerModels =
{
      "models/Humans/Group01/Male_01.mdl",
      "models/Humans/Group01/male_02.mdl",
      "models/Humans/Group01/male_03.mdl",
      "models/Humans/Group01/Male_04.mdl",
      "models/Humans/Group01/Male_05.mdl",
      "models/Humans/Group01/male_06.mdl",
      "models/Humans/Group01/male_07.mdl",
      "models/Humans/Group01/male_08.mdl",
      "models/Humans/Group01/male_09.mdl",
      "models/Humans/Group02/Male_01.mdl",
      "models/Humans/Group02/male_02.mdl",
      "models/Humans/Group02/male_03.mdl",
      "models/Humans/Group02/Male_04.mdl",
      "models/Humans/Group02/Male_05.mdl",
      "models/Humans/Group02/male_06.mdl",
      "models/Humans/Group02/male_07.mdl",
      "models/Humans/Group02/male_08.mdl",
      "models/Humans/Group02/male_09.mdl",

      "models/Humans/Group01/Female_01.mdl",
      "models/Humans/Group01/Female_02.mdl",
      "models/Humans/Group01/Female_03.mdl",
      "models/Humans/Group01/Female_04.mdl",
      "models/Humans/Group01/Female_06.mdl",
      "models/Humans/Group01/Female_07.mdl",
      "models/Humans/Group02/Female_01.mdl",
      "models/Humans/Group02/Female_02.mdl",
      "models/Humans/Group02/Female_03.mdl",
      "models/Humans/Group02/Female_04.mdl",
      "models/Humans/Group02/Female_06.mdl",
      "models/Humans/Group02/Female_07.mdl",
}

CreatePlayerVariable( "Aim", "Short", 10 );
CreatePlayerVariable( "Strength", "Short", 10 );
CreatePlayerVariable( "Endurance", "Short", 10 );
CreatePlayerVariable( "Speed", "Short", 10 );

CreatePlayerVariable( "CharID", "Short", 0 )
CreatePlayerVariable( "UID", "Short", 0 )


CreatePlayerVariable( "Money", "Short", 3 );
CreatePlayerVariable( "Model", "String", "" );
CreatePlayerVariable( "CID", "Short", 0 )
CreatePlayerVariable( "Age", "Short", 0 );

CreatePlayerVariable( "Sprint", "Short", 100 );
CreatePlayerVariable( "Holstered", "Bool", true );
CreatePlayerVariable( "Consciousness", "Short", 100 );
CreatePlayerVariable( "DrunkMul", "Float", 0 );

CreatePlayerVariable( "Title", "String", "" );
CreatePlayerVariable( "SecondTitle", "String", "" );

CreatePlayerVariable( "Bleeding", "Bool", false );
CreatePlayerVariable( "FreezeHead", "Bool", false );
CreatePlayerVariable( "CanSprint", "Bool", true );
CreatePlayerVariable( "Conscious", "Bool", true );
CreatePlayerVariable( "CombineFlags", "String", "" );

CreatePlayerVariable( "CharacterFlags", "String", "" );
CreatePlayerVariable( "AdminFlags", "String", "" );

CreatePlayerVariable( "Faction", "String", " " );
CreatePlayerVariable( "RadioFreq", "Short", -1 );
CreatePlayerVariable( "ClassMark", "String", "D" );
CreatePlayerVariable( "ClassStatus", "String", "Naturalised" );
CreatePlayerVariable( "Loans", "Short", 0 );

CreatePlayerVariable( "ChosenCharID", "Short", 0 )


--Get elapsed time in hours, minutes, and seconds
function GetHMS()

	local s = CurTime(); --How many total seconds do we have
	local totalm = math.floor( s / 60 ); --How many total minutes do we have
	local h = math.floor( totalm / 60 ); --How many total hours do we have
	
	local m = totalm - h * 60; --Minutes left
	s = s - totalm * 60; --Seconds left
	
	return h, m, math.floor( s );

end

function GetBanDate( mins )

	local months, d, h, m = SortHMS( mins );
	--local ty, tmonth, td, th, tm = TS.GetTimeDate();
	local ty, tmonth, td, th, tm = TS.GetFormattedTimeDate();
	local years = 0;
	years, months, d, h, m = ty, months + tmonth, d + td, h + th, m + tm;
	
	if months > 12 then
		months = months - 12
		years = years + 1
	end
	
	if d > 29 then
		d = d - 29
		months = months + 1
	end
	
	if h > 24 then
		h = h - 24
		d = d + 1
	end
	
	if m >= 59 then
		m = m - 59
		h = h + 1
	end
	
	return years, months, d, h, m;

end

function SortHMS( mins )

	local totalm = mins; --How many total minutes do we have
	local totalh = math.floor( totalm / 60 ); --How many total hours do we have
	local totald = math.floor( totalh / 24 ); --How many total days do we have
	local months = math.floor( totald / 31 ); --How many total months do we have
	
	local d = totald - months * 31 -- days left
	local h = totalh - totald * 24 -- hours left
	local m = totalm - totalh * 60; --Minutes left
	
	return months, d, h, m;

end

function FormatLine( str, font, size )

	local start = 1;
	local c = 1;
	
	surface.SetFont( font );
	
	local endstr = "";
	local n = 0;
	local lastspace = 0;
	
	while( string.len( str ) > c ) do
	
		local sub = string.sub( str, start, c );
	
		if( string.sub( str, c, c ) == " " ) then
			lastspace = c;
		end

		if( surface.GetTextSize( sub ) >= size ) then
			
			local sub2;
			
			if( lastspace == 0 ) then
				lastspace = c;
			end
			
			if( lastspace > 1 ) then
				sub2 = string.sub( str, start, lastspace - 1 );
				c = lastspace;
			else
				sub2 = string.sub( str, start, c );
			end
			
			endstr = endstr .. sub2 .. "\n";
			
			
			start = c + 1;
			n = n + 1;
		
		end
	
		c = c + 1;
	
	end
	
	if( start < string.len( str ) ) then
	
		endstr = endstr .. string.sub( str, start );
	
	end
	
	return endstr, n;

end
--[[
function FormatLine( str, font, size )

	local tbl = string.Explode( " ", str );
	
	surface.SetFont( font );
	
	local x = 0;
	local linewidth = 0;
	local spacewidth = surface.GetTextSize( " " );
	
	local endstr = "";
	local n = 0;
		
	for n = 1, #tbl do
	
		local sub = tbl[n];
		local width = surface.GetTextSize( tbl[n] );
		
		if( string.find( sub, "\n" ) then
		
			endstr = endstr .. sub;
			linewidth = 0;
			n = n + 1;
		
		elseif( width > size ) then
		
			endstr = endstr .. sub .. "\n";
			linewidth = 0;
			n = n + 1;
			
		elseif( width + spacewidth + linewidth > size ) then
		
			endstr = endstr .. "\n" .. sub .. " ";
			linewidth = 0;
			n = n + 1;
			
		else
		
			endstr = endstr .. sub .. " ";
			linewidth = width + linewidth;
		
		end
	
	end
	
	return endstr, n;

end
]]--

--Copy pasta code from garry's mod wiki BECAUSE I JUST DON'T GIVE A FUCK.
 function GetMap()
   local worldspawn = ents.GetByIndex(0)
   local mapname = worldspawn:GetModel()
  
   mapname = string.gsub(mapname,"(%w*/)","")
   mapname = string.gsub(mapname,".bsp","")
   
   return mapname
 end 

-- set max chars allowed.
MAX_CHARACTERS = 6;

--[[function PropDamage( ent1, ent2 )

	return ( not ent1:GetClass()=="prop_physics" && not ent2:IsPlayer() )
end
hook.Add( "PlayerShouldTakeDamage", "PropDamage", PropDamage)
]]--
